package com.wrial.simple;
/*
 * @Author  Wrial
 * @Date Created in 22:37 2020/3/25
 * @Description
 */

public class LeetCode_9 {
    public boolean isPalindrome(int x) {
        if(x<0) return false;
        int xValue = x;  // 记住x的值，在后面反序列的过程中x的值会改变

        int reverseNum = 0;
        while(x>0){
            reverseNum *= 10;
            reverseNum += x%10;
            x /=10;
        }
        return reverseNum == xValue;
    }

    public static void main(String[] args) {
        System.out.println(new LeetCode_9().isPalindrome(121));
    }


}
